import request from '@/axios';

export const dict = {
  dictionaryUrl: '/api/civil-system/dict/dictionary'
};

export const getList = (current, size, params) => {
  return request({
    url: '/api/civil-system/dict/list',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const remove = (ids) => {
  return request({
    url: '/api/civil-system/dict/remove',
    method: 'post',
    params: {
      ids
    }
  });
};

export const add = (row) => {
  return request({
    url: '/api/civil-system/dict/submit',
    method: 'post',
    data: row
  });
};

export const update = (row) => {
  return request({
    url: '/api/civil-system/dict/submit',
    method: 'post',
    data: row
  });
};

export const getDict = (id) => {
  return request({
    url: '/api/civil-system/dict/detail',
    method: 'get',
    params: {
      id
    }
  });
};

export const getDictTree = (code) => {
  return request({
    url: '/api/civil-system/dict/tree',
    method: 'get',
    params: {
      code
    }
  });
};

export const getDictionary = (code) => {
  return request({
    url: dict.dictionaryUrl,
    method: 'get',
    params: {
      code
    }
  });
};
